package trace.utils;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class constantUtils {
    public static String yesterday(String format) {
        LocalDate currentDate = LocalDate.now();
        LocalDate previousDate = currentDate.minusDays(1);
        // 定义你想要的日期格式
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
        // 将前一天的日期格式化为你想要的格式
        String formattedPreviousDate = previousDate.format(formatter);
        return formattedPreviousDate;
    }

    public static String today(String format) {
        LocalDate currentDate = LocalDate.now();
        // 定义你想要的日期格式
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
        // 将前一天的日期格式化为你想要的格式
        String date = currentDate.format(formatter);
        return date;
    }
}
